package com.huishi.entity.vo;

import com.huishi.entity.DictDataSource;
import com.huishi.entity.DictGather;
import com.huishi.entity.DictSystemModel;
import com.huishi.entity.DictTarget;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Optional;

/**
 * 文件落盘元数据信息表
 */
@Data
public class FileMetaDataKeepVO {
    private Long id;

    private String systemModel;
    private String gather;
    private String target;
    private Long systemModelId;
    private Long gatherId;
    private Long targetId;

    private Long dataSourceId;



    private Long pdwFormatId;


    private LocalDateTime gatherTime;

    private String centerFreq;

    private Integer pulseNum;

    private LocalDateTime inTime;

    private String fileName;

    private Long fileSize;

    private String fileLocation;

    private String createdBy;

    private String taskName;

    private String processLog;
    private String customColumn1;
    private String customColumn2;
    private String customColumn3;
    private String customColumn4;
    private String customColumn5;
    private String customColumn6;

    private String fileSuffix;


    public void setDicts(FileMetaDataVO fileMetaDataVO) {
        this.systemModel = Optional.ofNullable(fileMetaDataVO.getSystemModel()).map(DictSystemModel::getModel).orElse(null);
        this.gather = Optional.ofNullable(fileMetaDataVO.getDictGather()).map(DictGather::getGatherName).orElse(null);
        this.target = Optional.ofNullable(fileMetaDataVO.getDictTarget()).map(DictTarget::getTargetName).orElse(null);
        this.systemModelId = fileMetaDataVO.getSystemModel() == null ? null : fileMetaDataVO.getSystemModel().getId();
        this.gatherId = fileMetaDataVO.getDictGather() == null ? null : fileMetaDataVO.getDictGather().getId();
        this.targetId = fileMetaDataVO.getDictTarget() == null ? null : fileMetaDataVO.getDictTarget().getId();

//        this.dataSourceId = fileMetaDataVO.getDictDataSource() == null ? null : fileMetaDataVO.getDictDataSource().getId();
//        this.pdwFormatId = fileMetaDataVO.getDictPwdFormat() == null ? null : fileMetaDataVO.getDictPwdFormat().getId();
    }
}